package com.rabbiter.si.mapper;

import com.rabbiter.si.entity.StudentGrade;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

// StudentGradeMapper.java
@Mapper
public interface StudentGradeMapper {
    // 查询指定学期的所有成绩
    List<StudentGrade> selectByTerm(@Param("term") String term);

    // 检查记录是否存在
    int countByUniqueKey(@Param("studentId") String studentId,
                         @Param("courseId") String courseId,
                         @Param("term") String term);

    // 插入新成绩
    int insert(StudentGrade grade);

    // 更新成绩
    int update(StudentGrade grade);

    List<StudentGrade> selectAll();
}
